﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace File3
{
    class Program
    {
        static void Main(string[] args)
        {
            StreamWriter sw = File.CreateText("max.txt");
            int r = 0;
            int max = 0;
            string s = File.ReadAllText("text.txt");
            for (int i = 0; i < s.Length; i++)
            {
                for (int j = 0; j < s.Length; j++)
                {
                    if (j + 2 >= s.Length || i + 2 >= s.Length)
                    {
                        break;
                    }
                    if (s[i] == s[j] && s[i + 1] == s[j + 1] && s[i + 2] == s[j + 2])
                    {
                        r++;
                    }
                    if (max < r)
                    {
                        max = r;
                    }
                }
                r = 0;
            }
            sw.WriteLine(max);
            sw.Close();
        }
    }
}